   //find required upper node function 
   function findUpElement(e, testString){
     var container = null;
     var continuedIndex = 0;
     for(container = e; continuedIndex < 10 && (container != null && $(container).parent()) 
     && !$(container).is(""+testString); container = $(container).parent()){
       continuedIndex = continuedIndex + 1;
     }
     return container;
   }

   function getColName(td){
     var containerTD = findUpElement($(td),"td");
     var index = jQuery.inArray($(containerTD)[0], $(containerTD).parent().children());
     var table = findUpElement(td, "table.datatable");
     var colName = $($(table).find("tr th")[index]).attr("fieldname");
     return colName;
   }

   function getColTitle(td){
     var containerTD = findUpElement($(td),"td");
     var index = jQuery.inArray($(containerTD)[0], $(containerTD).parent().children());
     var table = findUpElement(td, "table.datatable");
     var colTitle = $($(table).find("tr th div.thOpContainerTitle")[index]).text();
     return colTitle;
   }
   
   
   function getTableName(td){
     var table = findUpElement(td, "table.datatable");
     var tableName = $(table).attr("datatablename");
     return tableName;
   }

   function getRowId(td){
     var tr = findUpElement(td,"tr");
     return $(tr).find("td[p-dataid]").text();
   }
   
   function getRowDataIdName(td){
     var tr = findUpElement(td,"tr");
     return getColName($(tr).find("td[p-dataid]"));
   }
   function getRowDataIdValue(td){
     var tr = findUpElement(td,"tr");
     return $(tr).find("td[p-dataid]").text();
   }
   function addRowData(td,data){
     var tr = findUpElement(td,"tr");
     var prefix = "$RD_$" + 0 + "_";
     var table = findUpElement(td, "table.datatable");
     var ths = $(table).find("tr th");
     var tds = $(tr).children("td");
     if(ths.length == tds.length){
       for(var index=0; index < ths.length;index++){
         var name = $(ths[index]).attr("fieldname");
         var value = $(tds[index]).text();
         data[prefix+name] = value;
       }
     }
   }